#include <MsTimer2.h>

// Switch on LED on pin 13 each second
#include "WProgram.h"
void pulse( );
void setup();
void loop();
long int usec = 500;

void pulse( )
{
  
  digitalWrite(9, HIGH);
  delayMicroseconds(usec);
  digitalWrite(9, LOW);
  delayMicroseconds(3333 - usec);
  
}

void setup() {
  pinMode(9, OUTPUT);
  
  MsTimer2::set(3.333, pulse); // 500ms period
  MsTimer2::start();
}

void loop() {
  
  usec = 850;
  delay(2000);
  usec = 1800;
  delay(2000);
}

int main(void)
{
	init();

	setup();
    
	for (;;)
		loop();
        
	return 0;
}

